﻿using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class Dmg_text : MonoBehaviour
{
	[SerializeField]
	private Text Num;
	[SerializeField]
    private Animator anim;

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}
	public void ini(int num,bool crit)
	{
		if (num >= 0) 
		{
			Num.text = "-" + num.ToString("G");
		}
		else if (num < 0)
		{
			Num.text = "<color=#00ff00>" + num.ToString("G") + "</color>";
		}
		
		if (crit) 
		{
			anim.SetTrigger("Crit");
		}
	}
	public void killself()
	{
		Destroy(gameObject);
	}
}
